"""
中间件
"""

from fastapi import Header
from lucky_draw_api.models import NoAuthorizedError


def check_token(token: str = Header(...)) -> str | NoAuthorizedError:
    """
    检查token
    """

    if token == "QWEzxc123":
        return token
    else:
        return NoAuthorizedError()
